package com.example.myapplication.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.myapplication.R;
import com.example.myapplication.polo.Classmate;

import java.util.List;

public class ClassmateAdapter extends BaseAdapter {
    LayoutInflater inflater;
    Context context;
    List<Classmate> list;

    public ClassmateAdapter( Context context, List<Classmate> list) {

        this.inflater = inflater;
        this.context = context;
        inflater=LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        view=inflater.inflate(R.layout.item_listview,null);
        TextView tv_name=(TextView) view.findViewById(R.id.tv_name);
        tv_name.setText(list.get(position).getName());

        return view;
    }
}
